/***********************************************************************************/
/*                                                                                 */
/*                                                                                 */
/*    @Project:Acme-ClusterMonitor                                                 */
/*    @ File Name : datatype.h                                                     */
/*    @ Date : 2011-8-1                                                            */
/*    @ Author : Li Chengyu                                                        */
/*    @Description : 存储结构定义                                                    */
/*                                                                                 */
/***********************************************************************************/

#ifndef DATATYPE_H
#define DATATYPE_H
struct max_min{
    int data;
    int node_id;
    max_min(){

    }
    max_min(int d,int n)
    {
        data = d;
        node_id = n;
    }
};

typedef struct max_min_ave{
    max_min max,min;
    int average;
    max_min_ave(){
        max.data=min.data=-1;
        max.node_id=min.node_id=0;
        average=0;
    }
}MMA;
typedef struct CPU{
    int user;
    int nice;
    int system;
    int wait;
    int idle;
    CPU()
    {
        user=nice=system=wait=idle=0;
    }
}JCpuInfo;

typedef struct MEM{
    int used,shared,cached,bufferd,swapped;
    MEM()
    {
        used=shared=cached=bufferd=swapped=0;
    }
}JMemInfo;

typedef struct TEMP{
    int temp;
    TEMP(){
        temp=0;
    }
}JTemperatureInfo;

typedef struct TRA{
    int in,out;
    TRA()
    {
        in=out=0;
    }
}JTrafficInfo;

typedef struct{
    QString hostname;
    QDateTime update_time;
    QHostAddress hostaddr;
    JCpuInfo cpu;
    JMemInfo mem;
    JTrafficInfo traffic;
    JTemperatureInfo temp;
    bool state;

}JInfo;
//定义总体数据结构体

typedef struct{
    MMA user;
    MMA nice;
    MMA idle;
    MMA wait;
    MMA system;
}JFcpu;
typedef struct{
    MMA used;
    MMA shared;
    MMA buffered;
    MMA cached;
    MMA swapped;
}JFmem;

typedef struct{
    MMA temp;
}JFtemperature;

typedef struct{
    MMA in;
    MMA out;
}JFtraffic;

typedef struct{
    JFcpu cpu;
    JFmem mem;
    JFtemperature temperature;
    JFtraffic traffic;
    int onlineHostNum;
}total_MMA;

#endif // DATATYPE_H
